import type { OrderParams, OrderPreResult,OrderDetailResult } from '@/types/order'
import { http } from '@/utils/http'

// 填写订单-获取预付订单
export const memberOrderPreApi = () => {
  return http<OrderPreResult>({
    method: 'GET',
    url: '/member/order/pre',
  })
}
// 填写订单-获取立即购买订单  addressId下单时已经选择好的地址id
export const memberOrderPreNowApi = (data: {
  skuId: string
  count: string
  addressId?: string
}) => {
  return http<OrderPreResult>({
    method: 'GET',
    url: '/member/order/pre/now',
    data,
  })
}
// 提交订单
export const postMemberOrderApi = (data: OrderParams) => {
  return http<{ id: string }>({
    method: 'POST',
    url: '/member/order',
    data,
  })
}
// 获取订单详情
export const memberOrderByIdApi = (id: string) => {
  return http<OrderDetailResult>({
    method: 'GET',
    url: `/member/order/${id}`,
  })
}
